package com.example.group4.controller;

import com.example.group4.pojo.Emp;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: group4
 * @description: Emp测试Controller
 * @author: Tan Gang
 * @create: 2021-08-10 20:36
 **/
@RestController
public class EmpController {

    /**
     * 打印一个Emp信息
     */
    @GetMapping("/emp")
    public Object getUser(){
        return new Emp(1,"Barry","P1242121","Senior Java engineer",22,"成都高新区");
    }

    /**
     * 打印三个Emp信息
     */
    @GetMapping("/empList")
    public Object getUsers() {
        List<Emp> list = new ArrayList<>();
        list.add(new Emp(1,"Mary","P1421123",".NET engineer",26,"成都武侯区"));
        list.add(new Emp(1,"Paul","P1312553","Front-end engineer",21,"成都高新区"));
        list.add(new Emp(1,"Mark","P1621123","UI designer",28,"成都双流区"));
        return list;
    }
}
